<?php include_once('class/autoload.php'); // pour inclure nos classes

class Auth{
/*
    static function islog(){
        global $connexion;
        if(isset($_SESSION['Auth']) && isset($_SESSION['Auth']['email'])){
            $q = array('email'=>$_SESSION['Auth']['email']);
            $sql = 'SELECT mail FROM eleve WHERE mail = :email';
            $req = $connexion->prepare($sql);
            $req->execute($q);
            $count = $req->rowCount($sql);
                if($count == 1){
                    return true;
                }else{
                    return false;
                }
        }else{
            return false;
        }
    }
}

*/
     static function islog(){
        global $connexion;
        if(isset($_SESSION['Auth']) && isset($_SESSION['Auth']['email']) && isset($_SESSION['Auth']['password'])){
            $q = array('email'=>$_SESSION['Auth']['email'],'password'=>$_SESSION['Auth']['password']);
            $sql = 'SELECT mail,mdp FROM eleve WHERE mail = :email AND mdp = :password';
            $req = $connexion->prepare($sql);
            $req->execute($q);
            $count = $req->rowCount($sql);
                if($count == 1){
                    return true;
                }else{
                    return false;
                }
        }else{
            return false;
        }
    }
}
 
?>
